﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class WebSite_s_paper_check : System.Web.UI.Page
{
    string userid;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserId"] == null || Session["UserIdentity"].ToString()!="0")
        {
            Response.Redirect("Default.aspx", false);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
            return;
        }
        else userid = Session["UserId"].ToString();

        if (!IsPostBack)
        {
            try
            {
                QuestionnaireHandler Qhandler = new QuestionnaireHandler();
                DataSet ds = new DataSet();
                ds = Qhandler.GetAllQuestionnaire();
                this.Repeater1.DataSource = ds;
                this.Repeater1.DataBind();
            }
            catch(Exception ex)
            {
                //跳转到错误处理页面。
                Session["ErrorMessage"] = ex.Message;
                Session["AtPage"] = "s_paper_check.aspx";
                Response.Redirect("s_error.aspx", false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
        }
    }
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "start")
        {
            Response.Redirect("s_paper.aspx?id=" + Convert.ToInt32(e.CommandArgument),false);
            return;
        }
    }
}
